//
//  HomeCell.m
//  TCProject
//
//  Created by admin on 16/1/20.
//  Copyright © 2016年 wise-wing. All rights reserved.
//

#import "HomeCell.h"
@interface HomeCell()

@property (weak, nonatomic) IBOutlet UIButton *dateButton;
@property (weak, nonatomic) IBOutlet UIButton *fangButton;

@property (weak, nonatomic) IBOutlet UIButton *titleButton;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;

@property (weak, nonatomic) IBOutlet UIButton *singlePriceButton;
@property (weak, nonatomic) IBOutlet UIButton *cartypeButton;
@property (weak, nonatomic) IBOutlet UIButton *distanceButton;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
- (IBAction)rushAction:(id)sender;


@end
@implementation HomeCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)rushAction:(id)sender {
    if (_operation) {
        _operation();
    }
    

}


- (void)setOrder:(CZOrder *)order
{
    _order = order;
    [_dateButton setTitle:[NSString stringWithFormat:@"用车时间：%@", _order.appointmentTime] forState:UIControlStateNormal];
    _priceLabel.text = [NSString stringWithFormat:@"￥%.1f", _order.sumPrice];
    [_titleButton setTitle:[NSString stringWithFormat:@"站点名称：%@", _order.stationName] forState:UIControlStateNormal];
    [_fangButton setTitle:[NSString stringWithFormat:@"需求方量：%.1f方", _order.volume] forState:UIControlStateNormal];
    [_cartypeButton setTitle:[NSString stringWithFormat:@"需求车型：%@(%ld辆)", _order.style1, _order.count] forState:UIControlStateNormal];
    [_distanceButton setTitle:[NSString stringWithFormat:@"%@：%@", _order.conditionName, _order.condition] forState:UIControlStateNormal];
    _countLabel.text = @(_order.count - _order.robCount).description;
    
    double singlePrice = _order.sumPrice / _order.volume;
    [self.singlePriceButton setTitle:[NSString stringWithFormat:@"方量单价：%.1f元/方", singlePrice] forState:UIControlStateNormal];
}
@end
